<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>青菜萝卜博客管理系统</title>
		<link rel="shortcut icon" type="image/png" href="static/i/favicon.png">
		<link rel="stylesheet" href="static/css/admin.css">
		<link rel="stylesheet" href="static/layui/css/layui.css">
		<link rel="stylesheet" href="static/editor.md/css/editormd.min.css" />
		<script src="static/layui/layui.js"></script>
	</head>
	<body>
		<div class="header">
			<h2 class="z cl"><a href="index.html"><img src="static/img/logo2.png"></a></h2>
			<div class="y cl">
				<a target="_blank" href="http://www.huding.name">网站首页</a>
				<a id="top-logout" href="javascript:">退出</a>
			</div>
		</div>
		<div class="admin">
			<div class="aleft" id="left-container"></div>
			<div class="aright">

				<fieldset class="layui-elem-field layui-field-title" style="margin: 20px 30px 20px 20px;">
					<legend>修改文章</legend>
				</fieldset>

				<form class="layui-form bform">
					<div id="content-cnt"></div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="blogEidt">立即提交</button>
							<button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script src="static/js/jquery.min.js"></script>
		<script src="static/editor.md/editormd.min.js"></script> 
		<script>
			layui.config({base:'static/js/'}).use('blog-edit');
		</script>
		<script id ="template" type="text/template">
			<div class="layui-form-item">
				<label class="layui-form-label">文章标题</label>
				<div class="layui-input-block">
					<input type="text" value="{{d.blog.title}}" name="blog.title" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
				</div>
			</div>
			<input type="hidden" name="blog.id" value="{{d.blog.id}}"/>
			<div class="layui-form-item" style="width: 300px;">
				<label class="layui-form-label">所属分类</label>
				<div class="layui-input-block" id="category">
					<select name="blog.categoryID">
						{{#  layui.each(d.category, function(index, item){ }}
							{{# if(item.id == d.blog.categoryID) { }}
								<option value="{{item.id}}" selected>{{item.name}}</option>
							{{# } else { }}
								<option value="{{item.id}}">{{item.name}}</option>
							{{# } }}
						{{# });}}
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">文章作者</label>
				<div class="layui-input-block">
					<input type="text" value="{{d.blog.author}}" name="blog.author" required lay-verify="required"  placeholder="请输入内容" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">缩略图</label>
				<div class="layui-input-block">
					<input type="hidden" value="{{d.blog.coverURL}}" name="blog.coverURL" id="blog-cover"/>
					<input type="file" name="image" id="blog-cover-file" class="layui-upload-file"/>
				</div>
			</div>
			
			<div class="layui-form-item" id="cover-preview-cnt">
				<label class="layui-form-label"></label>
				<div>
					{{# if(d.blog.coverURL) { }} 
						<img src="{{d.blog.coverURL}}" id="cover-preview-img" class="blog-report-cover"/>
					{{# } else { }}
						<img id="cover-preview-img" class="blog-report-cover"/>
					{{# } }}
				</div>
			</div>

			<!--<div class="layui-form-item">
				<label class="layui-form-label">关键字</label>
				<div class="layui-input-block">
					<input type="text" name="keywords" placeholder="请输入内容" autocomplete="off" class="layui-input">
				</div>
			</div>-->

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">文章摘要</label>
				<div class="layui-input-block">
					<textarea name="blog.summary" required lay-verify="required"  placeholder="请输入内容" class="layui-textarea">{{d.blog.summary}}</textarea>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">文章内容</label>
				<div class="layui-input-block">
					<div id="publish-editormd"></div>
				</div>
			</div>
			 <div class="layui-form-item">
			    <label class="layui-form-label">保存方式</label>
			    <div class="layui-input-block">
			      <select name="blog.status" lay-filter="aihao">
			        <option value=""></option>
			        <option value="0" selected="">发表</option>
			        <option value="1">草稿</option>
			      </select>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">文章标签</label>
			    <div class="layui-input-block">
			      <input type="text" value="{{d.blog.tags}}" name="blog.tags" required lay-verify="required"  placeholder="请输入内容" autocomplete="off" class="layui-input">
			    </div>
			  </div>
			 <hr>
		</script>
	</body>

</html>